//
//  AddTextView.m
//  IceBoxStrorage
//
//  Created by xieyanhong on 2023/8/21.
//

#import "AddTextView.h"

@implementation AddTextView

-(instancetype)init{
    if (self = [super initWithFrame:CGRectZero]) {
        [self initSubView];
    }
    
    return self;
}

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self initSubView];
    }
    return self;
}

- (void)initSubView{
    

    UIView *baseView = [[UIView alloc]init];
    [self addSubview:baseView];
    [baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self).insets(UIEdgeInsetsMake(8, 8, 8, 8));
    }];
    baseView.backgroundColor = rgba(245, 245, 245, 1);
    baseView.layer.cornerRadius = 4;
    baseView.layer.masksToBounds = YES;
    
    
    UILabel *titleLabel = [[UILabel alloc]init];
    [baseView addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@8);
        make.left.equalTo(@16);
    }];
    titleLabel.textAlignment = NSTextAlignmentLeft;
    titleLabel.font = [UIFont boldSystemFontOfSize:14];
    titleLabel.textColor = UIColor.blackColor;
    [titleLabel sizeToFit];
    self.nameLabel = titleLabel;
    
    UITextView *textFiled = [[UITextView alloc]init];
    [baseView addSubview:textFiled];
    [textFiled mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@16);
        make.right.equalTo(@-16);
        make.top.equalTo(titleLabel.mas_bottom).offset(8);
        make.bottom.equalTo(@-8);
    }];
    textFiled.layer.borderColor = rgba(145, 145, 145, 1).CGColor;
    textFiled.layer.borderWidth = 1;
    textFiled.textColor = [UIColor blackColor];
    textFiled.font = [UIFont systemFontOfSize:14];
    self.textView = textFiled;
    
    
}

@end
